/*
 *  Communication project implement communication point to point and multicast
 *  Copyright (C) 2010  Daniel Pelaez, Daniel Lopez, Hector Hurtado
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  
 *  This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
 *  See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 *  Any modifications to this file will be lost upon recompilation of the source schema. 
 *  Generated on: 2010.05.13 at 08:03:13 AM COT 
 */

package org.dht.com.msg;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;

/**
 * The <code>MessageType</code> class encapsulate a message type
 * 
 * <p>
 * Java class for Type complex type.
 * 
 * <p>
 * The following schema fragment specifies the expected content contained within
 * this class.
 * 
 * <pre>
 * <complexType name="Type">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="amountParams" use="required">
 *         <simpleType>
 *           <restriction base="{http://www.w3.org/2001/XMLSchema}int">
 *             <minInclusive value="0"/>
 *           </restriction>
 *         </simpleType>
 *       </attribute>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Type")
public class MessageType {

	/**
	 * Type name
	 */
	@XmlAttribute(required = true)
	protected String name;
	/**
	 * Amount params
	 */
	@XmlAttribute(required = true)
	protected int amountParams;

	/**
	 * Builds a message type empty
	 */
	MessageType() {

	}

	/**
	 * Builds a message type by name and amount params
	 * 
	 * @param name
	 *            Type name
	 * @param amountParams
	 *            Amount params
	 */
	public MessageType(String name, int amountParams) {
		this.name = name;
		this.amountParams = amountParams;
	}

	/**
	 * Gets the value of the name property.
	 * 
	 * @return possible object is {@link String }
	 * 
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the value of the name property.
	 * 
	 * @param value
	 *            allowed object is {@link String }
	 * 
	 */
	public void setName(String value) {
		this.name = value;
	}

	/**
	 * Gets the value of the amountParams property.
	 * 
	 */
	public int getAmountParams() {
		return amountParams;
	}

	/**
	 * Sets the value of the amountParams property.
	 * 
	 */
	public void setAmountParams(int value) {
		this.amountParams = value;
	}

	/**
	 * Compare two message type by name and amount paramsF
	 */
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj instanceof MessageType) {
			MessageType messageType = (MessageType) obj;

			if (messageType.getName().equals(name)
					&& messageType.getAmountParams() == amountParams) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
}
